﻿using System;
using fastCSharp;
using System.Reflection;

namespace diantou.web.ajax.report
{
    /// <summary>
    /// 举报操作
    /// </summary>
    class handle<callType, reportType> : userHandle<callType>
        where callType : handle<callType, reportType>
        where reportType : diantou.dataModel.report
    {
        /// <summary>
        /// 举报
        /// </summary>
        /// <param name="id"></param>
        /// <param name="onReturn"></param>
        [fastCSharp.code.cSharp.ajax]
        public virtual void Report(reportType value, Action<fastCSharp.net.returnValue<bool>> onReturn)
        {
            value.UserId = currentUser.Id;
            report(value, onReturn);
        }

        /// <summary>
        /// 举报
        /// </summary>
        private static readonly Action<reportType, Action<fastCSharp.net.returnValue<bool>>> report;
        static handle()
        {
            Type type = typeof(reportType);
            type = type.Assembly.GetType("diantou.dataAccess.tcpCall+" + type.Name);
            report = (Action<reportType, Action<fastCSharp.net.returnValue<bool>>>)Delegate.CreateDelegate(typeof(Action<reportType, Action<fastCSharp.net.returnValue<bool>>>), type.GetMethod("append", BindingFlags.Static | BindingFlags.Public, null, new Type[] { typeof(reportType), typeof(Action<fastCSharp.net.returnValue<bool>>) }, null));
        }
    }
}